Image Scaling Method and Apparatus

ABSTRACT

The present invention relates to image processing technologies, and discloses an image scaling method and apparatus to reduce distortion of a scaled image. The image scaling method includes: determining a distribution direction of main objects in a source image; and scaling the source image to a target image through a nonlinear scaling method according to the distribution direction of the main objects in the source image, where the nonlinear scaling method employs a scaling direction vertical to the distribution direction of the main objects in the source image. The embodiments of the present invention are primarily applicable to the image scaling field.

This application is a continuation of co-pending InternationalApplication No. PCT/CN2009/072093, filed Jun. 2, 2009, which designatedthe United States and was not published in English, and which claimspriority to Chinese Application No. 200810169225.4, filed Sep. 28, 2008,both of which applications are incorporated herein by reference.

TECHNICAL FIELD

The present invention relates to image processing technologies, and inparticular, to an image scaling method and apparatus.

BACKGROUND

Image scaling is a common image processing technology, and the scalingis rather difficult if the source image and the target image havedifferent aspect ratios. With the aspect ratios being different,distortion occurs when the source image is scaled up or down to thetarget image, especially when the aspect ratio of the source image issharply different from that of the target image.

A typical scenario of image scaling is the adaptation between an imagewith a 4:3 aspect ratio and an image with a 16:9 aspect ratio.Currently, the video communication system needs to be compatible withboth the standard-definition image (such as 4CIF) with the existingaspect ratio of 4:3 and the high-definition image (such as 720p and1080p) with a new aspect ratio of 16:9. The traditional Cathode Ray Tube(CRT) television sets generally employ an aspect ratio of 4:3, and thelatest high-definition Liquid Crystal Display (LCD) television setsgenerally employ an aspect ratio of 16:9. Therefore, there is a problemas regards how to scale a standard-definition video image with an aspectratio of 4:3 to an image presentable on a high-definition television setwith an aspect ratio of 16:9, and vice versa.

The prior art puts forward many solutions to the foregoing problem toimplement scaling between images with different aspect ratios, forexample, linear scaling, edge trimming, horizontal nonlinear scaling,and filling of black edges of images. However, in the process ofimplementing the present invention, the inventor finds at least thefollowing problems in the prior art.

When images are scaled through linear scaling, the method is simple, butdistortion of images is serious. When images are scaled through edgetrimming, the distortion of images is avoided, but the main objects ofthe images are vulnerable to loss. When the black edge of an image isfilled in the scaling process, the scaled image is smaller than thesource image, and it is impossible to fill the whole display area. Thefilling of the black edge leads to interference to the audience. When animage is scaled through a horizontal nonlinear scaling algorithm, if themain objects in the image are in the middle of the image, the mainobject area is little distorted after the scaling, and the visual effectis good; however, if the main objects (such as persons) exist on theedge of the image, the persons at the edge are distorted sharply againstthe persons in the middle of the image after the image scaling, and thevisual effect is deteriorated. Meanwhile, if objects are movinghorizontally, for example, captions which scroll horizontally or personswho walk horizontally, the captions or persons crossing areas aredistorted sharply, and the audience is sensitive to such distortion.

SUMMARY OF THE INVENTION

The embodiments of the present invention provide an image scaling methodand apparatus to reduce distortion of a scaled image.

To fulfill such objectives, the embodiments of the present invention arebased on the following technical solution.

An image scaling method includes: determining a distribution directionof main objects in a source image; and scaling the source image to atarget image through a nonlinear scaling method according to thedistribution direction of the main objects in the source image, wherethe nonlinear scaling method employs a scaling direction vertical to thedistribution direction of the main objects in the source image.

An image scaling apparatus includes: a distribution directiondetermining unit, adapted to determine a distribution direction of mainobjects in a source image; and an image scaling unit, adapted to scalethe source image to a target image through a nonlinear scaling methodaccording to the distribution direction of the main objects in thesource image, where the nonlinear scaling method employs a scalingdirection vertical to the distribution direction of the main objects inthe source image.

Through the image scaling method and apparatus under the presentinvention, the distribution direction of the main objects in the sourceimage is determined, and the source image is scaled to the target imagethrough a proper nonlinear scaling method according to the distributiondirection of the main objects in the source image. Therefore, the methodand apparatus under the present invention prevent distortion of thetarget image in the important area to which human eyes are sensitive,and reduce the distortion of the scaled image.

BRIEF DESCRIPTION OF THE DRAWINGS

To describe the technical solution under the present invention moreclearly, the following outlines the accompanying drawings involved inthe embodiments of the present invention. Apparently, the accompanyingdrawings outlined below are not exhaustive, and persons of ordinaryskill in the art can derive other drawings from such accompanyingdrawings without any creative effort.

FIG. 1 is a flowchart of an image scaling method provided in a firstembodiment of the present invention;

FIG. 2 is a flowchart of an image scaling method which applies avertical nonlinear scaling method in a second embodiment of the presentinvention;

FIG. 3 is a flowchart of an image scaling method which applies avertical nonlinear scaling method in a third embodiment of the presentinvention;

FIG. 4 shows segmenting of a source image and a target image in an imagescaling method provided in a fourth embodiment of the present invention;

FIG. 5 shows transformation relations of pixel positions at differentheights of a source image and a target image in the fourth embodiment ofthe present invention;

FIG. 6 a shows a source image and FIG. 6 b shows a target image afterscaling;

FIG. 7 shows segmenting of a source image and a target image in an imagescaling method provided in a fifth embodiment of the present invention;

FIG. 8 shows an image scaling apparatus provided in a sixth embodimentof the present invention;

FIG. 9 shows a structure of a distribution direction determining unit inthe image scaling apparatus provided in the sixth embodiment of thepresent invention; and

FIG. 10 shows a structure of an image scaling unit in the image scalingapparatus provided in the sixth embodiment of the present invention.

DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS

The present invention is hereinafter described in detail with referenceto exemplary embodiments and accompanying drawings. To describe thetechnical solution under the present invention more clearly, thefollowing outlines the accompanying drawings involved in the embodimentsof the present invention. Apparently, the accompanying drawings outlinedbelow are not exhaustive, and persons of ordinary skill in the art canderive other drawings from such accompanying drawings without anycreative effort.

First Embodiment

To reduce distortion of a scaled image, this embodiment puts forward animage scaling method. As shown in FIG. 1, the image scaling method inthis embodiment includes the following steps.

Step 11: Determine the distribution direction of the main objects in asource image.

The distribution direction of the main objects in the source image maybe determined by detecting the source image. The distribution directionof the main objects in the source image may be characterized by greatsymmetry, or even distribution, or rich textures.

The source image may be detected through face detection method, edgedetection method, or entropy coding method. Taking the face detectionmethod as an example, it is regarded that the persons in the scene arethe main objects. Therefore, before scaling of the image, thedistribution of the faces of persons is detected in the image, and thedistribution direction of the persons and the symmetry information areobtained as a basis for deciding the scaling direction. The facedetection method may be performed through a mature algorithm currentlyavailable. In an edge detection method, it is regarded that human eyesare sensitive to the area with rich textures (main objects) but notsensitive to the flat area with few textures (trivial objects).Therefore, the edge detection algorithm such as Sobel and Laplacian canbe used to calculate the edge distribution of the scene, and determinethe distribution of the main objects of the scene. Alternatively,through an entropy coding method, the direction with even distributionof the main objects is detected in the source image, and thedistribution of the main objects in the scene is determined.

Alternatively, the direction of the main objects in the image may bepreset to decide whether to employ a horizontal nonlinear scaling methodor to employ a vertical nonlinear scaling method, or to employ othermethods.

Step 12: Scale the source image to a target image through a nonlinearscaling method according to the distribution direction of the mainobjects in the source image, where the nonlinear scaling method employsa scaling direction vertical to the distribution direction of the mainobjects in the source image.

An image may be scaled in the horizontal direction or the verticaldirection, whichever makes the scaling direction of the image verticalto the distribution direction of the main objects. For example, when themain objects in the image are distributed vertically, the image isscaled according to the horizontal nonlinear scaling method in the priorart. When the main objects in the image are distributed horizontally,the image is scaled according to a vertical nonlinear scaling method.

Through the image scaling method in the first embodiment, thedistribution direction of the main objects in the source image isdetermined through detection of the image content, and the source imageis scaled to the target image through a proper nonlinear scaling methodaccording to the distribution direction of the main objects in thesource image. Therefore, the method provided in this embodiment avoidsdistortion of the target image in the important area to which human eyesare sensitive, and reduces the distortion of the scaled image.

In the image scaling process detailed below, the vertical nonlinearscaling method is taken as an example.

Second Embodiment

As shown in FIG. 2, an image scaling method which applies a verticalnonlinear scaling method in the second embodiment includes the followingsteps.

Step 21: Divide the source image into at least two segments in thescaling direction. Specifically, with respect to vertical nonlinearscaling, this step is to divide the source image into at least twosegments in the vertical direction.

Generally, the main objects such as persons or things in the scene aredistributed horizontally. The persons or things which change positionsin a wide scope move horizontally, for example, persons who walk in thescene. In the vertical direction of the image, few main objects aredistributed and contents change scarcely, and the symmetricaldistribution of the image contents in the horizontal direction is muchmore than the symmetrical distribution of the image contents in thevertical direction. The nonlinear scaling method in the prior art scalesthe image in the horizontal direction, which generates obviousdistortion in the horizontal direction. The vertical nonlinear scalingis better.

In the prior art, the horizontal nonlinear scaling method is almostsymmetrical. To obtain a better effect of image scaling, this embodimentuses an asymmetrical scaling method to scale an image on the basis ofvertical nonlinear scaling. In general scenes, the contents distributedvertically are of different importance. For example, in an indoor scene,persons and important things are generally centralized in the middle andlower part of the image, and trivial objects are generally distributedin the upper part of the image. The audience is generally sensitive tothe main objects, which should be protected from distortion in thescaling process. The upper part of the image is generally unimportant,and allows more distortion.

Based on the foregoing principles, in the method provided in the secondembodiment, the source image is divided into at least two segments inthe vertical direction. In the segmenting process, the height of eachsegment may be specified as required, or determined according to thepercentage of the height of each segment to the total height of thesource image. Moreover, all segments may have the same height or not.For example, supposing that the aspect ratio of the source image is 4:3,the source image may be divided into an upper segment, a middle segmentand a lower segment. The heights of the segments may be 30%, 50%, and20% of the total height of the source image respectively.

Step 22: Set a different scaling factor for each segment in the sourceimage.

In practice, the scaling factor may be set for the segment of the mainobjects and the segment of the trivial objects respectively in thesource image. For the segment that includes more main objects in thesource image, the scaling factor may be smaller; for the segment thatincludes fewer main objects in the source image, the scaling factor maybe larger. The scaling factor is set manually or empirically.

It is assumed that the source image is divided into three segments instep 21. In the source image, the middle segment and the lower segmentinclude a majority of the main objects, and the upper segment includes aminority of the main objects. Therefore, to prevent the important areacritical to human eyes from distortion, the scaling factor of the middlesegment and the lower segment is set to 1, and the scaling factor of theupper segment is set to 0.5. In an extreme circumstance, every pixel inthe source image is regarded as a segment, and a different scalingfactor is set for every pixel.

Step 23: Transform pixels in each segment of the source image into thetarget image at the corresponding scaling factor.

In the transformation process, the pixels of the source image are mappedto the pixels of the target image. In this way, valid image data can beselected for the target image. In practice, when a reverse mappingmethod is applied to the transformation process, in the correspondingsegment of the source image, one or more corresponding source pixels arefound for each target pixel in the target image, and then the coordinateposition and the value of the target pixel are determined in the sourceimage according to the coordinate position and the value of one or moresource pixels. In practice, a differential filtering algorithm such asbilinear differential filtering algorithm and cubic convolutioninterpolation algorithm may be used to calculate the value of the targetpixel.

In the image scaling method in the second embodiment, the image isscaled through asymmetrical scaling on the basis of vertical nonlinearscaling. Therefore, the method provided in the second embodimentprevents the important area critical to human eyes from distortion inthe target image, reduces the distortion caused in the scaling process,and achieves a better scaling effect of the image.

Third Embodiment

To improve efficiency and accuracy of image scaling, the thirdembodiment adds more steps after step 22 of the second embodiment, asshown in FIG. 3.

Step 31: Divide the source image into at least two segments, and thendivide the target image accordingly. At the time of segmenting thesource image, the width and the height of the target image may becalculated out according to the source image. The target image can besegmented in the same way as segmenting the source image. For example,the source image is divided into an upper segment, a middle segment, anda lower segment, and the heights of the segments are 30%, 50%, and 20%of the total height of the source image respectively; therefore, thetarget image can be divided into three segments according to the heightof the target image, and the heights of the segments are 20%, 60%, and20% of the total height of the target image respectively.

In the vertical nonlinear image scaling method provided in the secondand third embodiments above, because the main objects of an image aregenerally distributed in the middle part and the lower part of theimage, the source image is divided into at least two segments in thevertical direction, and a different scaling factor is set for eachsegment, and then the source image is transformed into the target imageat the scaling factors. Because the segmenting mode and the scalingfactor of each segment are determined according to the distribution ofmain objects in the image, the methods provided in the second embodimentand the third embodiment avoid distortion of the target image in theimportant area to which human eyes are sensitive, and reduce thedistortion caused in the scaling process.

Fourth Embodiment

The following describes the image scaling method in this embodiment,supposing that the aspect ratio of the source image is 4:3 and that theaspect ratio of the target image is 16:9.

To detect the source image and determine that the main objects in thesource image are distributed vertically, the following operations areperformed.

Step 41: As shown in FIG. 4, divide the source image into an uppersegment, a middle segment, and a lower segment. It is assumed that thewidth of the source image is W and that the height of the source imageis H. The source image is divided into an upper segment R₁, a middlesegment R₂, and a lower segment R₃, and the heights of the segments areH₁, H₂ and H₃ respectively, where H₁+H₂+H₃=H. After scaling, the widthof the target image is the same as the width of the source target, andthe height of the target image is H′. Accordingly, the target image isdivided into three segments, namely, an upper segment R′₁, a middlesegment R′₂, and a lower segment R′₃, and their heights are H′₁, H′₂ andH′₃ respectively, where H′₁+H′₂+H′₃=H′.

Step 42: Perform scaling for each segment in the source image. A reversemapping method is applied here. One or more source pixels correspondingto a target pixel of the target image are found in the source image, andthe coordinate position and the value of the target pixel are determinedin the target image according to the coordinate position and the valueof the source pixels.

It is assumed that the coordinates of the source image pixel I are (x,y), and that the coordinates of the target image pixel I′ are (x′, y′).According to the 2-dimensional image scaling transformation theory, thefollowing formula (1) applies:

$\begin{matrix}{\begin{bmatrix}x^{\prime} \\y^{\prime} \\1\end{bmatrix} = {\begin{bmatrix}S_{x} & 0 & 0 \\0 & S_{y} & 0 \\0 & 0 & 1\end{bmatrix}\begin{bmatrix}x \\y \\1\end{bmatrix}}} & (1)\end{matrix}$

where S_(x) is a scaling factor of transformation from the source imageto the target image in the horizontal direction, and S_(y) is thescaling factor in the vertical direction.

The reverse mapping relation from the target image to the source imageis (2):

$\begin{matrix}{\begin{bmatrix}x \\y \\1\end{bmatrix} = {\begin{bmatrix}{1/S_{x}} & 0 & 0 \\0 & {1/S_{y}} & 0 \\0 & 0 & 1\end{bmatrix}\begin{bmatrix}x^{\prime} \\y^{\prime} \\1\end{bmatrix}}} & (2)\end{matrix}$

In this embodiment, the reverse mapping relation in formula (2) can beused to deduce the transformation relations in formulas (3)-(5):

For I,I′εR₁, the following formula applies:

$\begin{matrix}{\begin{bmatrix}x \\y \\1\end{bmatrix} = {\begin{bmatrix}1 & 0 & 0 \\0 & {H_{1}/H_{1}^{\prime}} & 0 \\0 & 0 & 1\end{bmatrix}\begin{bmatrix}x^{\prime} \\y^{\prime} \\1\end{bmatrix}}} & (3)\end{matrix}$

For I,I′εR₂, the following formula applies:

$\begin{matrix}{\begin{bmatrix}x \\y \\1\end{bmatrix} = {\begin{bmatrix}1 & 0 & 0 \\0 & {H_{2}/H_{2}^{\prime}} & 0 \\0 & 0 & 1\end{bmatrix}\begin{bmatrix}x^{\prime} \\y^{\prime} \\1\end{bmatrix}}} & (4)\end{matrix}$

For I,I′εR₃, the following formula applies:

$\begin{matrix}{\begin{bmatrix}x \\y \\1\end{bmatrix} = {\begin{bmatrix}1 & 0 & 0 \\0 & {H_{3}/H_{3}^{\prime}} & 0 \\0 & 0 & 1\end{bmatrix}\begin{bmatrix}x^{\prime} \\y^{\prime} \\1\end{bmatrix}}} & (5)\end{matrix}$

Through formulas (3)-(5) above, the source pixels corresponding to thetarget pixel of the target image can be determined in the source image,the coordinate positions of the corresponding source pixels areobtained, and the valid image data corresponding to the target image isdetermined in the source image.

FIG. 5 shows transformation relations of pixel positions on differentheights of a source image and a target image. As shown in FIG. 5, thepixels in the same segment are scaled linearly, and the scaling factorvaries between segments. Therefore, the entire image is scalednonlinearly. In the foregoing example, the transformation relation takeson a fold line; if every pixel is regarded as a segment and a scalingfactor is specified for it, the transformation relation takes on acontinuous curve.

Step 43: Perform data transformation for the target image aftertransformation. For example, perform filtering or average smoothing forthe target image.

In the transformation, the pixel position mapped from the target imageto the source image is generally not an integer, but a fraction.Therefore, the target image needs to be processed through aninterpolation filtering algorithm, for example, a bilinear interpolationalgorithm or a cubic convolution algorithm. The following descriptiontakes the bilinear interpolation algorithm as an example. First, thelinear interpolation algorithm is introduced below. Values of fourneighboring points around an origin are interpolated linearly in twodirections to obtain values of the points to be sampled. That is, thecorresponding weight is determined according to the distance between thepoint to be sampled and the neighboring point, and the value of thepoint to be sampled is calculated out. A fractional mapping position maybe divided into an integer part and a decimal part that falls within[0,1), supposing that i, j are the integer part of the pixel, and thatu, v are the decimal part, where u, v ε[0,1). Therefore, the value ofthe pixel f(i+u, j+v) can be determined according to four neighboringpixels around through this formula:

f(i+u,j+v)=(1−u)(1−v)f(i,j)+(1−u)vf(i,j+1)+u(1−v)f(i+1,j)+uvf(i+1,j+1)  (6)

To obtain better processing effects, the interpolation may be based on acubic convolution algorithm, which is an improvement of the bilinearinterpolation algorithm. It allows for not only the impact caused by thegrayscale values of the four neighboring points, but also the impactcaused by the change rate of the grayscale value between the neighboringpoints, and uses pixel values in wider neighboring areas around thepoint to be sampled to perform three interpolations. Its principles arethe same as the principles of the prior art, and are not furtherdescribed here.

FIG. 6 a shows a source image with an aspect ratio of 4:3, and FIG. 6 bshows a target image after the source image is scaled vertically throughan asymmetrical nonlinear scaling method provided herein. In FIG. 6 a,the main objects of the image are distributed in the middle part and thelower part of the image, as indicated by the rectangle and the circle inFIG. 6 a. In the image scaling process, a cubic convolution algorithm isapplied as an interpolation algorithm. Because the main objects of thesource image are centralized in the middle part and the lower part ofthe image and distributed horizontally, the scaling factor of the upperpart is larger, and the scaling factor of the middle part and the lowerpart is very small and approaches 1. The comparison between FIG. 6 a andFIG. 6 b shows that in the scaled image, the main objects are scarcelydistorted in the middle part and the lower part, to which the human eyesare sensitive, and that the trivial objects in the upper part aredistorted greatly.

The principles of scaling an image with an aspect ratio of 16:9 to animage with an aspect ratio of 4:3 are the same as the principlesdescribed in the fourth embodiment. The difference is that the aspectratio of the source image is 16:9, and the aspect ratio of the targetimage is 4:3.

In the image scaling method in the fourth embodiment, the distributionof the main objects in the image is taken into account, and the segmentsof the source image and the corresponding scaling factor are determinedaccording to the distribution of main objects in the image. Therefore,the method avoids distortion of the target image in the area of the mainobjects, reduces the distortion caused in the scaling process, andbrings a good visual effect.

Fifth Embodiment

As shown in FIG. 7, it is assumed that the main objects in the sourceimage take on a 45° angle to the horizontal, and the scaling directionof the nonlinear scaling method takes on a 135° angle to the horizontal.The fifth embodiment includes the following steps.

Step 51: Divide the source image into an upper segment, a middlesegment, and a lower segment at an angle of 45° to the horizontal,supposing that the three segments of the source image from the upperleft side to the lower right side are R1 ₁, R1 ₂, and R1 ₃ respectively.Accordingly, divide the target image into three segments at an angle of45° to the horizontal, supposing that the three segments from the upperleft side to the lower right side are R1′₁, R1′₂, and R1′₃ respectively.

Step 52: Perform scaling for each segment in the source image. A reversemapping method may be applied here. One or more source pixelscorresponding to a target pixel of the target image are found in thesource image, and the coordinate position and the value of the targetpixel are determined in the target image according to the coordinateposition and the value of the source pixels. This step may be based onthe method described in the fourth embodiment above.

Step 53: Perform data transformation for the target image aftertransformation. For example, perform filtering or average smoothing forthe target image. Similarly to the fourth embodiment, in thetransformation, the pixel position mapped from the target image to thesource image is generally not an integer, but a fraction. Therefore, thetarget image needs to be processed through an interpolation filteringalgorithm, for example, a bilinear interpolation algorithm or a cubicconvolution algorithm.

Through the image scaling method in the fifth embodiment, thedistribution direction of the main objects in the source image isdetermined through detection of the image content, and the source imageis scaled to the target image through a proper nonlinear scaling methodaccording to the distribution direction of the main objects in thesource image. Therefore, the method provided in this embodiment avoidsdistortion of the target image in the important area to which human eyesare sensitive, and reduces the distortion of the scaled image.

Sixth Embodiment

An image scaling apparatus is provided in this embodiment.

As shown in FIG. 8, the image scaling apparatus in the sixth embodimentincludes a distribution direction determining unit 81 and an imagescaling unit 82.

The distribution direction determining unit 81 is adapted to determine adistribution direction of main objects in a source image; and the imagescaling unit 82 is adapted to scale the source image to a target imagethrough a nonlinear scaling method according to the distributiondirection of the main objects in the source image, where the nonlinearscaling method employs a scaling direction vertical to the distributiondirection of the main objects in the source image.

The distribution direction determining unit 81 may determine thedistribution direction of main objects in the source image in differentmodes. As shown in FIG. 9, the distribution direction determining unit81 may include a detecting module 811, which is adapted to detect thesource image and determine the distribution direction of the mainobjects in the source image.

Depending on the result of the distribution direction determining unit81, the image scaling unit 82 may apply different scaling methods. Forexample, when the main objects in the image are distributed vertically,the image scaling unit 82 applies a horizontal nonlinear scaling methodin the prior art. When the main objects in the image are distributedhorizontally, the image scaling unit 82 applies a vertical nonlinearscaling method. Any scaling method is appropriate as long as the scalingdirection of the image is vertical to the distribution direction of themain objects.

As shown in FIG. 10, the image scaling unit 82 includes a segmentsetting module 821, adapted to divide the source image into at least twosegments vertically, and set a different scaling factor for eachsegment; and an image transforming module 822, adapted to transformpixels in each segment of the source image into the target image at thecorresponding scaling factor.

As shown in FIG. 10, the image transforming module 822 includes a pixelmapping submodule 8221, adapted to query a segment of the source imagefor at least one source pixel corresponding to each target pixel in eachcorresponding segment of the target image; and an image generatingsubmodule 8222, adapted to determine coordinate positions and values ofthe target pixels in the target image according to the coordinatepositions and values of the source pixels.

Through the image scaling apparatus in the sixth embodiment, thedistribution direction of the main objects in the source image isdetermined through detection of the image content, and the source imageis scaled to the target image through a proper nonlinear scaling methodaccording to the distribution direction of the main objects in thesource image. Therefore, the apparatus provided in this embodimentavoids distortion of the target image in the important area to whichhuman eyes are sensitive, and reduces the distortion of the scaledimage.

Seventh Embodiment

To improve efficiency and accuracy of image scaling, on the basis of theimage scaling apparatus shown in FIG. 9 and FIG. 10, the segment settingmodule 821 is further adapted to divide the target image into at leasttwo segments corresponding to the source image. Similarly to the methodembodiment described above, at the time of segmenting the source image,the width and the height of the target image may be calculated outaccording to the source image. The target image can be segmented in thesame way as segmenting the source image.

The apparatus provided in the seventh embodiment avoids distortion ofthe target image in the important area to which human eyes aresensitive, reduces the distortion of the scaled image, and improvesefficiency and accuracy of image scaling.

In conclusion, through the image scaling method and apparatus in theembodiments of the present invention, the distribution direction of themain objects in the source image is determined through detection of theimage content, and the source image is scaled to the target imagethrough a proper nonlinear scaling method according to the distributiondirection of the main objects in the source image. Therefore, the methodand apparatus under the present invention prevent distortion of thetarget image in the important area to which human eyes are sensitive,and reduce the distortion of the scaled image.

After reading the foregoing embodiments, those skilled in the art areclearly aware that the present invention may be implemented throughhardware, or through software in addition to a necessary universalhardware platform. The technical solution under the present inventionmay be embodied in a software product. The software product may bestored in a nonvolatile storage medium (such as a Compact Disk-Read OnlyMemory (CD-ROM), a Universal Serial Bus (USB) flash disk, or a mobilehard disk), and may incorporate several instructions that enable acomputer device (such as a personal computer, a server, or a networkdevice) to perform the methods provided in any embodiment of the presentinvention.

The above descriptions are merely exemplary embodiments of the presentinvention, but not intended to limit the scope of the present invention.Any modifications, variations or replacements that can be easily derivedby those skilled in the art should fall within the scope of the presentinvention. Therefore, the scope of the present invention is subject tothe appended claims.

1. An image scaling method, comprising: determining a distributiondirection of main objects in a source image; and scaling the sourceimage to a target image through a nonlinear scaling method according tothe distribution direction of the main objects in the source image,wherein the nonlinear scaling method employs a scaling directionvertical to the distribution direction of the main objects in the sourceimage, wherein determining the distribution direction and scaling thesource image are performed in a computer device.
 2. The image scalingmethod according to claim 1, wherein determining the distributiondirection of the main objects in the source image comprises detectingthe source image to determine the distribution direction of the mainobjects in the source image.
 3. The image scaling method according toclaim 2, wherein, if the distribution direction of the main objects inthe source image is determined as horizontal, the step of scaling thesource image to the target image through the nonlinear scaling methodaccording to the distribution direction of the main objects in thesource image comprises: dividing the source image into at least twosegments vertically; setting a different scaling factor for each segmentin the source image; and transforming pixels in each segment of thesource image into the target image at a corresponding scaling factor. 4.The image scaling method according to claim 3, wherein, after dividingthe source image into at least two segments vertically, the methodfurther comprises dividing the target image into at least two segmentscorresponding to the source image.
 5. The image scaling method accordingto claim 3, wherein setting a different scaling factor for each segmentin the source image comprises setting a scaling factor for each segmentof the main objects and each segment of trivial objects respectively inthe source image.
 6. The image scaling method according to claim 3,wherein transforming the pixels in each segment of the source image intothe target image at the corresponding scaling factor comprises: queryinga segment of the source image for at least one source pixelcorresponding to each target pixel in each corresponding segment of thetarget image; and determining coordinate positions and values of targetpixels in the target image according to coordinate positions and valuesof the source pixels.
 7. An image scaling apparatus, comprising: adistribution direction determining unit, adapted to determine adistribution direction of main objects in a source image; and an imagescaling unit, adapted to scale the source image to a target imagethrough a nonlinear scaling method according to the distributiondirection of the main objects in the source image, wherein the nonlinearscaling method employs a scaling direction vertical to the distributiondirection of the main objects in the source image.
 8. The image scalingapparatus according to claim 7, wherein the distribution directiondetermining unit comprises: a detecting module, adapted to detect thesource image and determine the distribution direction of the mainobjects in the source image.
 9. The image scaling apparatus according toclaim 7, wherein the image scaling unit comprises: a segment settingmodule, adapted to divide the source image into at least two segmentsvertically, and set a different scaling factor for each segment; and animage transforming module, adapted to transform pixels in each segmentof the source image into the target image at a corresponding scalingfactor.
 10. The image scaling apparatus according to claim 9, wherein:the segment setting module is further adapted to divide the target imageinto at least two segments corresponding to the source image.
 11. Theimage scaling apparatus according to claim 9, wherein the imagetransforming module comprises: a pixel mapping submodule, adapted toquery a segment of the source image for at least one source pixelcorresponding to each target pixel in each corresponding segment of thetarget image; and an image generating submodule, adapted to determinecoordinate positions and values of target pixels in the target imageaccording to coordinate positions and values of source pixels.
 12. Theimage scaling apparatus according to claim 7, wherein the distributiondirection determining unit and the image scaling unit are units of acomputer device.
 13. The image scaling apparatus according to claim 12,wherein the distribution direction determining unit and the imagescaling unit comprises a software product that incorporates severalinstructions that enable the computer device.
 14. A non-transitorycomputer-readable storage medium with an executable program storedthereon, wherein the program instructs a computer device to perform thefollowing steps: determining a distribution direction of main objects ina source image; and scaling the source image to a target image through anonlinear scaling method according to the distribution direction of themain objects in the source image, wherein the nonlinear scaling methodemploys a scaling direction vertical to the distribution direction ofthe main objects in the source image.
 15. The computer-readable storagemedium of claim 14, wherein the step of determining the distributiondirection of the main objects in the source image comprises detectingthe source image to determine the distribution direction of the mainobjects in the source image.
 16. The computer-readable storage medium ofclaim 15, wherein, if the distribution direction of the main objects inthe source image is determined as horizontal, the step of scaling thesource image comprises: dividing the source image into at least twosegments vertically; setting a different scaling factor for each segmentin the source image; and transforming pixels in each segment of thesource image into the target image at a corresponding scaling factor.17. The computer-readable storage medium of claim 16, wherein, afterdividing the source image into at least two segments vertically, theprogram further instructs the computer device to divide the target imageinto at least two segments corresponding to the source image.
 18. Thecomputer-readable storage medium of claim 16, wherein the step ofsetting a different scaling factor for each segment in the source imagecomprises setting a scaling factor for each segment of the main objectsand each segment of trivial objects respectively in the source image.19. The computer-readable storage medium of claim 16, wherein the stepof transforming the pixels in each segment of the source image into thetarget image at the corresponding scaling factor comprises: querying asegment of the source image for at least one source pixel correspondingto each target pixel in each corresponding segment of the target image;and determining coordinate positions and values of target pixels in thetarget image according to coordinate positions and values of the sourcepixels.